package com.frxuexi.mdm2204.demo

import android.util.Log
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.size
import androidx.compose.foundation.shape.CircleShape
import androidx.compose.material3.Button
import androidx.compose.material3.ButtonDefaults
import androidx.compose.material3.ElevatedButton
import androidx.compose.material3.FilledTonalButton
import androidx.compose.material3.OutlinedButton
import androidx.compose.material3.Text
import androidx.compose.material3.TextButton
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.draw.clip
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.layout.ContentScale
import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.dp
import androidx.navigation.NavHostController
import coil.compose.AsyncImage

//@Preview
@Composable
fun Demo03(navHostController: NavHostController) {
    Column {
        Button(onClick = {
            Log.i("===","按钮1")
            navHostController.navigate("demo04/aa")
        }) {
            Text(text = "按钮1")
        }
        FilledTonalButton(onClick = {
            Log.i("===","按钮2")
            navHostController.navigate("demo05")
        }) {
            Text(text = "按钮2")
        }

        OutlinedButton(onClick = {
            Log.i("===","按钮3")
        }) {
            Text(text = "按钮3")
        }

        ElevatedButton(onClick = { Log.i("===","按钮4") }) {
            Text(text = "按钮4")
        }

        //contentColor:按钮的文字颜色,containerColor:按钮的背景颜色
        TextButton(colors=ButtonDefaults.textButtonColors(contentColor = Color.White, containerColor = Color.Green),
            onClick = { Log.i("===","按钮5") }) {
            Text(text = "按钮5")
        }

        AsyncImage(model = "https://img0.baidu.com/it/u=3517553771,449336921&fm=253&app=138&size=w931&n=0&f=JPEG&fmt=auto?sec=1726160400&t=1ea2f6dfe914e245595abc8df03bfbf9", contentDescription = "",
            modifier = Modifier
                .size(80.dp)
                .clip(CircleShape),
            contentScale= ContentScale.Crop
        )
    }
}